package com.dhcc.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhcc.dao.CouMatDao;
import com.dhcc.model.CouMat;
import com.dhcc.model.User;
import com.dhcc.service.CouMatService;
import com.dhcc.utils.PageControl;
import com.dhcc.utils.Pager;

/**
 * 资料管理实现类
 * @author zhangkairong
 *
 */
@Transactional
@Service("couMatService")
public class CouMatServiceImpl implements CouMatService{

	@Autowired
	private CouMatDao couMatDao;
	
	
	@Override
	public void save(CouMat couMat) {
		
		couMatDao.save(couMat);
	}

	@Override
	public void update(CouMat couMat) {
		
	}

	@Override
	public void delete(CouMat couMat) {
		couMatDao.delete(couMat);
	}

	@Override
	public CouMat get(Long id) {
		return couMatDao.get(id);
	}

	@Override
	public List<CouMat> query() {
		return couMatDao.query();
	}

	@Override
	public Pager<CouMat> query(int currentPage) {
		
		PageControl pageControl = new PageControl();
		pageControl.setCurrentIndex(currentPage);
		
		return couMatDao.query(pageControl);
	}

	@Override
	public void datchDelete(String ids) {
		
		int i = couMatDao.datchDelete(ids);
		
		if(i==0){
			
			throw new RuntimeException("批量删除失败");
		}
		
	}

}
